package presenter;

import base.BasePresenter;
import base.ResultCallBack;
import bean.VideoDataBean;
import model.VideoDataModel;
import view.VideoDataView;

/**
 * Created by 裘翔 on 2019/11/11.
 */

public class VideoDataPresenter extends BasePresenter<VideoDataView> implements ResultCallBack<VideoDataBean> {
    private VideoDataModel videoDataModel;

    public VideoDataPresenter() {
        this.videoDataModel = new VideoDataModel();
        addModel(videoDataModel);
    }

    public void loadData(int id) {
        videoDataModel.loadData(this, id);
    }

    @Override
    public void onSuccess(VideoDataBean dataBean) {
        if (mView != null) {
            mView.onSuccess(dataBean);
        }
    }

    @Override
    public void onFail(String error) {
        if (mView != null)
            mView.showToast(error);
            mView.onFailed(error);
    }
}
